#ifndef TASKBARICON_H_
#define TASKBARICON_H_

#include <wx/taskbar.h>
#include <wx/timer.h>
#include <wx/icon.h>
#include "../../core/events/MessageEvent.h"
#include "../../core/events/MessageReadEvent.h"
#include "../../core/interfaces/iModule.h"

namespace Impp
{

class TaskBarIcon : public wxTaskBarIcon
{
private:
	bool unreadMsgs;
	bool blinkSwitch;
	wxTimer timer;
	wxIcon iconImpp;
	wxIcon iconNewMsg;

	enum{
		ID_TIMER = wxID_HIGHEST +1
	};

public:
	TaskBarIcon();
	virtual ~TaskBarIcon();
	void onLeftUp(wxTaskBarIconEvent & event);
	virtual wxMenu* CreatePopupMenu();
	void onBlink(wxTimerEvent & event);
	void onMessageIn(MessageEvent & event);
	void onMessageRead(MessageReadEvent & event);

private:
	void setUnreadMsgs(bool unreadMsgs);


private:
    DECLARE_EVENT_TABLE()

};

class StdTaskBarIconModule : public iModule{

	DECLARE_DYNAMIC_CLASS(StdTaskBarIconModule)

private:
	TaskBarIcon* icon;

public:
	StdTaskBarIconModule() :
		icon(NULL){};
	virtual ~StdTaskBarIconModule(){};

	virtual void moduleInit(){
		icon = new TaskBarIcon();
	};

	virtual void moduleDestroy(){
		wxDELETE(icon);
	}
};

}

#endif /*TASKBARICON_H_*/
